package iface;

import java.io.Serializable;

/**
 * An objects used to register users
 * 
 * @author Jeff
 * 
 */
public class Registration implements Serializable, Message {

    private static final long serialVersionUID = 2L;
    private String phone;
    private String username;
    private UserTypes type;

    /**
     * Constructs a new Registration object
     * 
     * @param username
     *            the user to register
     * @param type
     *            the user's type
     * @param phone
     *            the user's phone number
     */
    public Registration(String username, UserTypes type, String phone) {
        if (username == null || phone == null)
            throw new IllegalArgumentException();

        this.username = username;
        this.type = type;
        this.phone = phone;
    }

    /**
     * @return the user's name
     */
    public String getUser() {
        return this.username;
    }

    /**
     * @return true if the user is a zombie, false otherwise
     */
    public boolean isZombie() {
        return type.equals(UserTypes.ZOMBIE);
    }

    /**
     * @return the user's type
     */
    public UserTypes getUserType() {
        return type;
    }

    /**
     * @return the user's phone
     */
    public String getPhoneNo() {
        return phone;
    }

    /**
     * @return the String representation of a Registration object.
     */
    public String toString() {
        return "[Register] " + username + ", " + phone;
    }

}
